<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <a href="#">WMS</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">Task</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">pack</a>
            <i class="fa fa-circle"></i>
        </li>
        <li>
            <a href="#">pack Task List</a>
        </li>
    </ul>
</div>
<div class="container-fluid" style="margin: 15px;">
    <div class="portlet light bordered">
        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject bold">General Pack Task List</span>
            </div>
         
        </div>
        <div class="portlet-body form form-horizontal">
            <form>
                <div class="row form-group">
                    <div class="col-md-3">
                        <label>Task ID</label>
                        <lt-tags-input ng-model="search.taskIds" placeholder="Enter Task ID" fill="TASK-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
                    </div>
                    <div class="col-md-3">
                        <label>Order ID:</label>
                        <lt-tags-input ng-model="search.orderIds" placeholder="Enter Order ID" fill="DN-" ng-keyup="keyUpSearch($event)"></lt-tags-input>
                    </div>
                    <div class="col-md-3">
                        <label>Assignee</label>
                        <user-auto-complete name="assignee" allow-clear="true"
                                            ng-model="search.assigneeUserId"></user-auto-complete>
                    </div>
                    <div class="col-md-3">
                        <label>Status</label>
                        <task-status-auto-complete  allow-clear="true" ng-model="search.status"></task-status-auto-complete>
                    </div>

                </div>
                <div class="row form-group">
                    <div class="col-md-3">
                        <label>Start Time</label>
                        <lt-date-time placeholder="From" date-format="yyyy-mm-dd hh:ii" minute-step="60"
                                      value="search.startTimeFrom"></lt-date-time>
                    </div>
                    <div class="col-md-3" style="padding-top: 25px;">
                        <lt-date-time placeholder="To" date-format="yyyy-mm-dd hh:ii" minute-step="60"
                                      value="search.startTimeTo"></lt-date-time>
                    </div>
                    <div class="col-md-3">
                        <label>End Time</label>
                        <lt-date-time placeholder="From" date-format="yyyy-mm-dd hh:ii" minute-step="60"
                                      value="search.endTimeFrom"></lt-date-time>
                    </div>
                    <div class="col-md-3" style="padding-top: 25px;">
                        <lt-date-time placeholder="To" date-format="yyyy-mm-dd hh:ii" minute-step="60"
                                      value="search.endTimeTo"></lt-date-time>
                    </div>
                </div>
                <div class="form-group form-actions right" style="padding: 0px;">
                    <waitting-btn type="submit" btn-class="btn blue" ng-click="searchTasks()"
                                  value="'search'" is-loading="searching"></waitting-btn>
                </div>
            </form>
            <div class="table-scrollable">
                <table class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th>Task ID</th>
                        <th>Order IDs</th>
                        <th>Status</th>
                        <th>Priority</th>
                        <th>Assignee</th>
                        <th>locationIds</th>
                        <th>Delivery Request Date</th>
                        <th>StartTime</th>
                        <th>EndTime</th>
                        <th>Date Created</th>
                        <th>Description</th>
                        <th  permission-check="{{'task::generalPackTask_write'}}">Actions</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-repeat="task in tasks">
                        <td><a ng-href="{{'#/wms/task/pack-task/general/' + task.id + '/view'}}" target="_blank">{{task.id}}</a></td>
                        <td>
                            <span ng-repeat="orderId in task.orderIds track by $index">
                                <a ng-href="{{'#/wms/outbound/order/' + orderId}}" target="_blank">{{orderId}}</a>
                            </span>
                        </td>
                        <td>
                            {{task.status}}
                            <span ng-if="task.status == 'In Progress'">&nbsp; {{(task.progress * 100).toFixed(1)}}%</span>
                            <progress ng-if="task.status == 'In Progress'" value="{{(task.progress * 100).toFixed(1)}}" max="100"></progress>
                        </td>
                        <td>{{task.priority}}</td>
                        <td>{{task.assignee.firstName}} {{task.assignee.lastName}}</td>
                        <td>
                            <span  ng-repeat="locationId in task.locationIds track by $index">
                                {{locationMap[locationId].name}}&nbsp;
                            </span>
                        </td>
                        <td>{{task.madb | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
                        <td>{{task.startTime | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
                        <td>{{task.endTime | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}</td>
                        <td>{{task.createdWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}<span ng-show="task.createdBy">({{task.createdBy}})</span></td>
                        <!-- <td>{{task.updatedWhen | amDateFormat:'YYYY-MM-DD HH:mm:ss'}}<span ng-show="task.updatedBy">({{task.updatedBy}})</span></td> -->
                        <td>
                           {{task.description}}
                        </td>
                        <td  permission-check="{{'task::generalPackTask_write'}}">
                            <a ng-click="deleteTask(task.id)"
                               ng-show="task.status == 'New'" title="Delete">Delete</a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>
            <pager total-count="paging.totalCount" current-page ="paging.pageNo" page-size="pageObj.pageSize"  load-content="loadContent(currentPage)"></pager>

        </div>
    </div>
</div>
